package models;

import play.data.format.Formats;
import play.db.ebean.Model;

import javax.persistence.*;
import java.util.Date;
import java.util.Locale;

/**
 * Created by richard on 24/06/14.
 */
@Entity
public class Absence extends Model {

    public static final String PATTERN = "yyyy-MM-dd HH:mm";

    @Column(name="employe_id")
    @ManyToOne
    public Employe employe;


    public long getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Date getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut) {
        this.dateDebut = dateDebut;
    }

    public Date getDateFin() {
        return dateFin;
    }

    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
    long id;

   // @Formats.DateFormatter

    @Formats.DateTime(pattern="dd/MM/yyyy hh:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    public Date dateDebut = new Date();
    @Formats.DateTime(pattern="dd/MM/yyyy hh:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    public Date dateFin = new Date();



   /* @Override
    public void save() {
        createdAt();
//        super.save();
    }
    @Column(name = "created_at")
    @Formats.DateTime(pattern="dd/MM/yyyy hh:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    public Date createdAt = new Date();;

    @Column(name = "updated_at")
    @Formats.DateTime(pattern="dd/MM/yyyy hh:mm:ss")
    @Temporal(TemporalType.TIMESTAMP)
    public Date updatedAt = new Date();;


    @Override
    public void update() {
        updatedAt();

        super.update();
    }



    @PrePersist
    void createdAt() {
        this.createdAt = this.updatedAt = new Date();
    }
    @PreUpdate
    void updatedAt() {
        this.updatedAt = new Date();
    }*/
}
